package com.cskaoyan.bean.bo.goods;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import net.sf.json.JSONArray;

import java.math.BigDecimal;
import java.util.Arrays;
import java.util.Date;
import java.util.List;

/**
 * @Author: 冯子靖
 * @Description:    商品其他信息
 * @Date: 2022/7/19 13:20
 */
@Data
@TableName("market_goods")
public class CreateGoodsBO {

    @TableId(type = IdType.AUTO)
    private Integer id;

    private String goodsSn;

    private String name;

    private Integer categoryId;

    private Integer brandId;

    private String gallery;

    private String keywords;

    private String brief;

    private Boolean isOnSale;

    private String picUrl;

    private Boolean isNew;

    private Boolean isHot;

    private String unit;

    private BigDecimal counterPrice;

    private String detail;

    private Date addTime;

    private Date updateTime;

    public void setGallery(List<String> gallery) {
        if (gallery.size() < 1) {
            this.gallery = "";
        } else {
            this.gallery = JSONArray.fromObject(gallery).toString();
        }
    }
}
